package com.wondersgroup.fjzlpt.yyzyzx.controller.rest.yyzycx;

import com.alibaba.fastjson.JSONObject;
import com.quick.framework.boot.web.utils.RequestUtils;
import com.wondersgroup.fjzlpt.yyzyzx.beans.req.yyzycx.sscwcx.SscwPageQueryAllReq;
import com.wondersgroup.fjzlpt.yyzyzx.beans.req.yyzycx.sscwcx.SscwQueryAllForExcelReq;
import com.wondersgroup.fjzlpt.yyzyzx.beans.resp.yyzycx.sscwcx.SscwPageQueryAllResp;
import com.wondersgroup.fjzlpt.yyzyzx.service.inter.yyzycx.CwxxService;
import com.wondersgroup.fjzlpt.yyzyzx.util.ControllerUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.util.Map;

/**
 * 实时床位查询
 * <p>
 * <p>
 * Created by sanma on 2017/8/2.
 */
@RestController
@RequestMapping("/sscwcx")
@Api(value = "实时床位信息查询接口" , tags = {"实时床位信息查询接口"} ,description = "用于查询，导出excel实时床位信息")
public class SscwRestController {

    @Autowired
    private CwxxService cwxxService;

    /**
     * 分页查询床位信息
     * @param request
     * @return
     */
    @ApiOperation(value = "实时床位信息查询", notes = "根据条件分页查询实时床位信息" , response = SscwPageQueryAllResp.class)
    @RequestMapping(value = "/pageQueryAll" ,   method = RequestMethod.POST)
    public JSONObject pageQueryAll(HttpServletRequest request , SscwPageQueryAllReq requestBean){
        Map map = RequestUtils.GetParameterMap(request);
        ControllerUtils.pageFormat(map);
        ControllerUtils.setQueryParams(map,request);
        return cwxxService.pageQueryCwxxAll(map);
    }
    
    /**
     * 导出数据
     * @param request
     * @return
     */
    @ApiOperation(value = "实时床位信息Excel导出", notes = "根据条件导出实时床位信息" )
    @RequestMapping(value = "/queryAllForExcel" ,   method = RequestMethod.POST)
    public void queryAllForExcel(HttpServletRequest request, HttpServletResponse response , SscwQueryAllForExcelReq requestBean){
        Map map = RequestUtils.GetParameterMap(request);
        ControllerUtils.setQueryParams(map,request);
        cwxxService.queryAllForExcel(map, request, response);
    }
}
